package com.example.commonsinterface.service;
import com.example.commonsinterface.dto.WeatherResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import org.springframework.web.client.RestTemplate;


@Service
public class commonsInterface{

    @Autowired
    private RestTemplate restTemplate;

//    获取第三方天气接口服务
    public WeatherResponse search(String cityid) {
        WeatherResponse result = restTemplate.getForObject("https://apis.tianapi.com/tianqi/index?key=e584a8733731fc929e8ead2b5844cbf5&city=" + cityid + "&type=7", WeatherResponse.class);
        return result;
    }
}
